import Taro from '@tarojs/taro';
import { Image, Text, View } from '@tarojs/components';
import React, { useEffect, useState } from 'react';
import './index.less';
interface SelfInfoProps {
  title?: string;
  account?: string;
  brand?: string;
  ip?: string;
  portrait?: string;
  userTagBrandInfoVo?: any;

  onExit: () => void;
}

export const SelfInfo: React.FC<SelfInfoProps> = ({
  title,
  account,
  brand,
  ip,
  portrait,
  userTagBrandInfoVo,
  onExit,
}) => {
  return (
    <View className="user-center-head">
      <View className="user-center-head-left">
        <View className="user-center-name">
          {title}
          {userTagBrandInfoVo && (
            <Image className="brand-icon" src={userTagBrandInfoVo.brandImage} />
          )}
          {userTagBrandInfoVo && (
            <Text className="brand-name">{userTagBrandInfoVo.id}</Text>
          )}
        </View>
        <View className="user-center-account">账号：{account}</View>
        <View className="user-center-account">IP属地：{ip}</View>
      </View>
      <View className="user-center-head-right" onClick={onExit}>
        <Image
          src={
            portrait ||
            'https://file.linkcook.cn/image/wineMiniProgram/home/portrait.png'
          }
        />
      </View>
    </View>
  );
};
